home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
ctlib100.zip
/
INSTALL.LZH
/
CTLISTS.INT
< prev
next >
Wrap
Text File
|
1996-10-12
|
6KB
|
184 lines
{**************************************************************************}
{* BitSoft Development, L.L.C. *}
{* Copyright (C) 1995, 1996 BitSoft Development, L.L.C. *}
{* All rights reserved. *}
{* Linked list objects unit *}
{* Version 2.2.8 *}
{**************************************************************************}
unit ctLists;
{$X+}
interface
uses Objects,
Containr, ctTypes;
type
PListNode = ^TListNode;
TListNode = object(TNode)
Next : PListNode;
constructor Init;
constructor Load (var S : TStream);
destructor Done; virtual;
procedure Delete; virtual;
procedure DeleteNext; virtual;
function Insert (NewNode : PListNode) : Boolean; virtual;
function InsertBefore (NewNode : PListNode) : Boolean; virtual;
function Prev : PListNode; virtual;
procedure Store (var S : TStream);
end; { TListNode }
type
PDoubleNode = ^TDoubleNode;
TDoubleNode = object(TListNode)
PrevNode : PDoubleNode;
constructor Init;
constructor Load (var S : TStream);
procedure Delete; virtual;
procedure DeleteNext; virtual;
function Insert (NewNode : PListNode) : Boolean; virtual;
function InsertBefore (NewNode : PListNode) : Boolean; virtual;
function Prev : PListNode; virtual;
end; { TDoubleNode }
type
PStringListNode = ^TStringListNode;
TStringListNode = object(TListNode)
{$ifdef Windows}
Text : PChar;
{$else}
Text : PString;
{$endif WIndows}
{$ifdef Windows}
constructor Init (AString : PChar);
{$else}
constructor Init (AString : String);
{$endif Windows}
constructor Load (var S : TStream);
destructor Done; virtual;
function KeyOf : Pointer; virtual;
procedure Store (var S : TStream);
end; { TStringListNode }
type
PStringDoubleNode = ^TStringDoubleNode;
TStringDoubleNode = object(TDoubleNode)
{$ifdef Windows}
Text : PChar;
{$else}
Text : PString;
{$endif WIndows}
{$ifdef Windows}
constructor Init (AString : PChar);
{$else}
constructor Init (AString : String);
{$endif Windows}
constructor Load (var S : TStream);
destructor Done; virtual;
function KeyOf : Pointer; virtual;
procedure Store (var S : TStream);
end; { TStringDoubleNode }
type
PList = ^TList;
TList = object(TSequence)
LastNode : PListNode;
constructor Init;
constructor Load (var S : TStream);
destructor Done; virtual;
function At (Index : LongInt) : Pointer; virtual;
function AtDelete (Index : LongInt) : Boolean; virtual;
function AtFree (Index : LongInt) : Boolean; virtual;
function AtInsert (Index : LongInt; Item : Pointer) : Boolean; virtual;
function AtPut (Index : LongInt; Item : Pointer) : Boolean; virtual;
function DeleteAll : Boolean; virtual;
function Empty : Boolean; virtual;
function FreeAll : Boolean; virtual;
function Head : PListNode; virtual;
function IndexOf (Item: Pointer) : LongInt; virtual;
function Last(var Index : LongInt) : Pointer; virtual;
procedure Store (var S : TStream);
function Tail : PListNode; virtual;
private
CurrentNode : PListNode;
PreviousNode : PListNode;
CurrentIndex : LongInt;
end; { TList }
type
PDoubleList = ^TDoubleList;
TDoubleList = object(TList)
function At (Index : LongInt) : Pointer; virtual;
function FreeAll : Boolean; virtual;
end; { TDoubleList }
type
PSortedList = ^TSortedList;
TSortedList = object(TList)
CaseSensitive : Boolean;
Duplicates : Boolean;
constructor Init;
constructor Load (var S : TStream);
function Insert (Item : Pointer) : Boolean; virtual;
function Search (Key : Pointer; var Index : LongInt) : Boolean; virtual;
procedure Store (var S : TStream);
end; { TSortedList }
type
PSortedDoubleList = ^TSortedDoubleList;
TSortedDoubleList = object(TSortedList)
function At (Index : LongInt) : Pointer; virtual;
function FreeAll : Boolean; virtual;
end; { TSortedDoubleList }
procedure DisposeList (var List : PListNode);
function GetList (var S : TStream) : PListNode;
function PutList (var S : TStream; List : PListNode) : Boolean;
procedure RegisterLists;
const
RList : TStreamRec = (
ObjType : idList;
VmtLink : Ofs(TypeOf(TList)^);
Load : @TList.Load;
Store : @TList.Store);
RDoubleList : TStreamRec = (
ObjType : idDoubleList;
VmtLink : Ofs(TypeOf(TDoubleList)^);
Load : @TDoubleList.Load;
Store : @TDoubleList.Store);
RSortedList : TStreamRec = (
ObjType : idSortedList;
VmtLink : Ofs(TypeOf(TSortedList)^);
Load : @TSortedList.Load;
Store : @TSortedList.Store);
RSortedDoubleList : TStreamRec = (
ObjType : idSortedDoubleList;
VmtLink : Ofs(TypeOf(TSortedDoubleList)^);
Load : @TSortedDoubleList.Load;
Store : @TSortedDoubleList.Store);
RStringListNode : TStreamRec = (
ObjType : idStringListNode;
VmtLink : Ofs(TypeOf(TStringListNode)^);
Load : @TStringListNode.Load;
Store : @TStringListNode.Store);
RStringDoubleNode : TStreamRec = (
ObjType : idStringDoubleNode;
VmtLink : Ofs(TypeOf(TStringDoubleNode)^);
Load : @TStringDoubleNode.Load;
Store : @TStringDoubleNode.Store);
implementation
end.